﻿@model PagedList<kxcxw.Data.Entities.Activity>
@using kxcxw.Data.Common
@{
    ViewBag.Title = "活动列表";
    Layout = "~/Areas/Admin/Views/Shared/_InfoLayout.cshtml";
}
<script src="../../Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#searchbtn").click(function () { 
            var title=$("#txtTitle").val();
            var shoptype=$("#ShopTypeList").val();
            var status=$("#StatusList").val();
            var href="@(CommonRepositories.UrlReplace(Request.Url.ToString(), "searchString", "searchkeyword"))";
            href=href.replace("searchkeyword","title:"+title+";shoptype:"+shoptype+";status:"+status);
            window.location.href=href;
        });
       $(".delete").click(function () {
            var id=$(this).attr("id");
            if (confirm("确定要拒绝这条广告么？")) {
                $.ajax({
                    type: "POST",
                    url: "@Url.Action("DoneShengHe", "ActivityM")",
                    data: "ActivityId="+id+"&status=3",
                    success: function (msg) {
                        if(msg=="true")
                        {
                            alert("您已拒绝了这条广告");
                            window.location.href=window.location.href;
                        }
                        else
                        {
                            alert("操作出错！");
                        }
                    }
                });
                
            }
            else {
                return false;
            }
        });
        $(".edit").click(function () {
            var id=$(this).attr("id");
            if (confirm("确定要通过这个促销活动吗？")) {
                $.ajax({
                    type: "POST",
                    url: "@Url.Action("DoneShengHe", "ActivityM")",
                    data: "ActivityId="+id+"&status=1",
                    success: function (msg) {
                        if(msg=="true")
                        {
                            alert("您已通过了这条广告");
                            window.location.href=window.location.href;
                        }
                        else
                        {
                            alert("操作出错！");
                        }
                    }
                });
            }
            else {
                return false;
            }
        });
    });
</script>
<h2>
    @Html.ActionLink("信息管理", "Index") &raquo; @Html.ActionLink("活动列表", "Index", "AcitvityM", null, new { @class = "active" })</h2>
<div id="main">
    <div id="searchBar">
        @using (Html.BeginForm())
        {
            <fieldset>
                标题：<input type="text" id="txtTitle" class="text-medium" value="@ViewBag.searchTitle" />
                @Html.DropDownList("ShopTypeList", "--请选择店类型--")
                @Html.DropDownList("StatusList")
                <input id="searchbtn" type="button" value="查询" />
            </fieldset>
        }
    </div>
    @{Html.RenderPartial("List", Model); }
</div>
